/*
 * @Author: your name
 * @Date: 2021-07-20 14:38:03
 * @LastEditTime: 2021-07-23 15:49:13
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \cuiyuan_activity\assets\script\scene\scene_3.ts
 */
// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

import SceneContent from "../ContentScene";
import Controller from "../Controller";

const { ccclass, property } = cc._decorator;

@ccclass
export default class Scene_3 extends cc.Component {

    fly: cc.Node = null;
    btn: cc.Node = null;
    onload() {

    }

    init() {
        this.fly = cc.find('fly', this.node);
        this.btn = cc.find('btn', this.node);
        this.btn.active = true
        this.stopAnimation();
        SceneContent.inst.controllScene(2, false, false, 'pause', false);
    }
    play() {
        this.btn.active = false
        this.showAnimation();
        SceneContent.inst.startMusic();
        this.scheduleOnce(() => {
            SceneContent.inst.controllScene(1, false, false, 'play');
            Controller.inst.show()

        }, 2)
    }
    showAnimation() {
        let animationClip = this.fly.getComponent(cc.Animation)
        animationClip.play()
    }
    stopAnimation() {
        let animationClip = this.fly.getComponent(cc.Animation)
        animationClip.stop()
    }
    start() {

    }

    // update (dt) {}
}
